﻿using System.Windows;
using System.Windows.Controls;
using System.Timers;
using System;
using System.Windows.Automation.Peers;
using System.Windows.Automation.Provider;
using LEET.CommonInterfaces;

namespace GUI.Custom_Classes
{
    /// <summary>
    /// Interaction logic for SI_Start.xaml
    /// </summary>
    public partial class SI_Start : SI_Base
    {
        public SI_Start(Nil d)
            : base(d)
        {
            InitializeComponent();

            Args_Box.Visibility = Visibility.Hidden;

            Setup_Events(Exe_Box);
            Setup_Events(Args_Box);
            Setup_Events(TF_Box);
        }

        private void TF_Box_SelectionChanged(object sender, SelectionChangedEventArgs e) 
        {
            if (Exe_Box == null || Args_Box == null || TF_Box == null)
                return;
            if (e.RemovedItems.Count == 0)
                return;

            if ((e.AddedItems[0] as ComboBoxItem).Content.ToString().Equals("true"))
            {
                TF_Box.Visibility = Visibility.Hidden;
                Args_Box.Visibility = Visibility.Visible;
            }
            else if ((e.AddedItems[0] as ComboBoxItem).Content.ToString().Equals("false"))
                TF_Box.Visibility = Visibility.Hidden;

            base.onUpdateDelegate();
        }

        public override string ToString()
        {
            return Exe_Box.Text.Trim() + (TF_Box.Text.Equals("true") ? " | " + Args_Box.Text.Trim() : "");
        }
    }
}